<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="hh.g" %>
<%@ page contentType="text/html; charset=gb2312" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP '306.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
   <body>
    <% ArrayList goodslist=(ArrayList)session.getAttribute("goodslist"); %>
<table border="3" width="600" rules="none" cellspacing="0" cellpadding="0">
	<tr height="30"><td colspan="3">热卖商品</td></tr>
	<tr align="center" height="30">
		<td>名称</td>
		<td>价格（元/斤）</td>
		<td>购买</td>
	</tr>
	<% if(goodslist==null||goodslist.size()==0) { %>
	<tr height="250"><td colspan="4" align="center"></td></tr>
	<% }
		else{
		for(int i=0;i<goodslist.size();i++){
		g single=(g)goodslist.get(i);
	 %>
	 <tr height="50" align="center">
	 <td><%=single.getName() %></td>
	 <td><%=single.getPrice() %></td>
	 <td><a href="306d.jsp?action=buy&id=<%=i %>">购买</a></td>
	 </tr>
	 <%
	 	}
	 	}
	  %>
	  <tr height="50">
	  	<td align="center" colspan="3"><a href="306s.jsp">查看购物车</a></td>
	  </tr>
</table>
  </body>
</html>
